<html>

	<head>
		<meta charset="UTF-8">
		<title>图片缩放Js</title>
		<script type="text/javascript" src="js/jquery-1.11.3.js" charset="UTF-8"></script>
		<script type="text/javascript">
			function behuge() {
				var oldwidth = document.getElementById("img1").offsetWidth;
				var oldheight = document.getElementById("img1").offsetHeight;
				console.log(oldwidth);
				var div = document.getElementById("img1");
				div.style.width = oldwidth + 5 + "px";
				div.style.height = (((oldwidth + 5) * oldheight)/oldwidth) +"px";
			}

			function besmall() {
				var oldwidth = document.getElementById("img1").offsetWidth;
				var oldheight = document.getElementById("img1").offsetHeight;
				console.log(oldwidth);
				var div = document.getElementById("img1");
				div.style.width = oldwidth - 5 + "px";
				div.style.height = (((oldwidth - 5) * oldheight)/oldwidth) + "px";
			}
		</script>
	</head>

	<body style="text-align: center;">
		<img src="img/1d.jpg" name="img1" id="img1" />
		<div>
			<button onclick="behuge()">放大</button>
			<button onclick="besmall()">缩小</button>
		</div>

	</body>

</html>